<!-- 锚点定位 -->

<style>
  html, body{
    padding: 0 15px;
    scroll-behavior: smooth;
  }

  h2{
    margin: 0;
    padding: .8em 0;
    scroll-margin: 20px;
  }
  nav{
    position: fixed;
    top: 15px;
    right: 15px;
    background: #fff;
    padding: 10px 0;
    border-radius: 4px;
    overflow: hidden;
  }
  nav>a{
    position: relative;
    display: block;
    line-height: 2;
    padding: 0 15px;
    font-size: 14px;
    color: #191919;
    text-decoration: none;
  }
  nav>a:hover{
    background-color: #d5d5d54a;
  }
  section{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  section span{
    width: 30%;
    height: 100px;
    border-radius: 4px;
    background-color: #E4CCFF;
  }
</style>
<nav>
  <a href="#e1">一、标题一</a>
  <a href="#e2">二、标题二</a>
  <a href="#e3">三、标题三</a>
  <a href="#e4">四、标题四</a>
  <a href="#e5">五、标题五</a>
  <a href="#e6">六、标题六</a>
</nav>
<h1>CSS 电梯导航</h1>
<div class="content">
  <h2 id="e1">一、标题一</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
<div class="content">
  <h2 id="e2">二、标题二</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
<div class="content">
  <h2 id="e3">三、标题三</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
<div class="content">
  <h2 id="e4">四、标题四</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
<div class="content">
  <h2 id="e5">五、标题五</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
<div class="content">
  <h2 id="e6">六、标题六</h2>
  <section>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </section>
</div>
